package com.xsd.awen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xsd.awen.domain.entity.SysApp;
import com.xsd.awen.domain.po.SysAppPagePo;
import com.xsd.awen.domain.vo.SysAppVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SysAppMapper extends BaseMapper<SysApp> {

    @Select("<script> " +
            " select u.* from t_tk_sys_app u " +
            " where 1=1 " +
            "<if test=\"sysApp.name != null and sysApp.name != ''\"> and u.name like CONCAT('%', #{sysApp.name}, '%')</if>" +
            " order by u.create_time desc " +
            "</script>")
    List<SysAppPagePo> page(SysAppVo sysAppVo);

    @Select(" select count(1) from t_tk_sys_app where name = #{name} ")
    Integer countSysApp(SysApp sysApp);

    @Select(" select count(1) from t_tk_sys_app where name = #{name} and id != #{id} ")
    Integer countUpdateSysApp(SysApp sysApp);

}